$(function(){

    $('#dialog').jqm({
        modal:true
    }).jqDrag('.jqDrag');;
    jQuery("#list2").jqGrid({
       	url:'counters/get_data',
	datatype: "json",
       	colNames:['ID','业务单号','S／O', '柜号', '封条号','数量'],
       	colModel:[
       		{name:'id',index:'id', width:45,editable:false, editoptions:{readonly:true,size:10}},
       		{name:'code',index:'code', width:150, editable:true,editoptions:{size:20}},
       		{name:'so',index:'so', width:160, editable:true,editoptions:{size:20}},
       		{name:'guihao',index:'guihao', width:140, align:"right", editable:true,editoptions:{size:20}},
       		{name:'fengtiaohao',index:'fengtiaohao', width:140, align:"right", editable:true,editoptions:{size:20}},		
       		{name:'cbm',index:'cbm', width:140,align:"right", editable:true,editoptions:{size:20}}	
       	],
       	rowNum:10,
       	rowList:[10,20,30],
       	pager: '#pager2',
       	sortname: 'code',
        viewrecords: true,
        sortorder: "desc",
        caption:"JSON Example",
        multiselect: true,
        editurl:"someurl.php"
        
    });
    jQuery("#list2").jqGrid('navGrid','#pager2',{edit:true,add:true,del:true});

    $("#bedata").click(function(){
	    var gr = jQuery("#list2").jqGrid('getGridParam','selrow');
            $.ajax({
                url: 'counters/edit',
                type: 'GET',
                data: {"id":gr},
               
                dataType: 'html',
                timeout: 1000,
                error: function(){
                    alert('Error loading XML document');
                },
                success: function(text){
                    $('#div_editor').html(text)
                    $('#dialog').jqmShow();
                }
            });
	    //if( gr != null ) jQuery("#list2").jqGrid('editGridRow',gr,{height:280,reloadAfterSubmit:false});
	    //else alert("Please Select Row");
    });
    
    
    
})


function change_css(value){
    $("#skin").attr("href",value);     
}

